package net.dgg.zz.common.utils;

import net.dgg.framework.tac.utils.bean.DggRestResponse;

import java.util.List;
import java.util.Map;

/**
 * dataTable 表格返回数据结构体
 * @Author:HDC
 * @Date: Created in 2018/5/8 16:13
 */
public class DataTableResponse extends DggRestResponse {
    private Object recordsTotal;// 总记录数
    private Object recordsFiltered; // 当前记录数
    private Object draw;// datatable必要参数

    public DataTableResponse data(Map params, List<?> data) {
        this.recordsTotal = params.get("count");
        this.recordsFiltered = params.get("count");
        this.draw = params.get("draw");
        this.setData(data);
        return this;
    }

    public DataTableResponse data(List<?> data) {
        this.recordsTotal = 0;
        this.setData(data);
        return this;
    }

    public Object getRecordsTotal() {
        return recordsTotal;
    }

    public void setRecordsTotal(Object recordsTotal) {
        this.recordsTotal = recordsTotal;
    }

    public Object getRecordsFiltered() {
        return recordsFiltered;
    }

    public void setRecordsFiltered(Object recordsFiltered) {
        this.recordsFiltered = recordsFiltered;
    }

    public Object getDraw() {
        return draw;
    }

    public void setDraw(Object draw) {
        this.draw = draw;
    }
}
